const Router = require('koa-router')
const router = new Router({ prefix: '/users' })
const {
 register,
 login,
 changePassword
} = require('../controller/user.controller')
const { userValidator,
 varifyUser,
 crpytPassword,
 varifyLogin
} = require('../middleware/user.middleware')
const { auth } = require('../middleware/auth.middleware')

// 合法性判断 userValidator
// 合理性判断 varifyUser
router.post('/register', userValidator, varifyUser, crpytPassword, register)
router.post('/login', userValidator, varifyLogin, login)
router.patch('/', auth, crpytPassword, changePassword)
module.exports = router
